package org.jeecg.config;

import org.jeecg.access.platform.service.BaseGetDataService;
import org.jeecg.access.platform.service.PlatformHandler;
import org.jeecg.access.service.UnifiedPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @description: todo
 * @author: taogang
 * @date: 2025/8/5 15:13
 */
@Component
public class PlatformGetDataFactory {

    private final Map<String, BaseGetDataService> dataServiceMap = new ConcurrentHashMap<>();

    @Autowired
    public PlatformGetDataFactory(List<BaseGetDataService> handlers) {
        for (BaseGetDataService service : handlers) {
            dataServiceMap.put(service.getPlatformType(), service);
        }
    }

    public Map<String, BaseGetDataService> getServiceMap() {
        return dataServiceMap;
    }

    public BaseGetDataService getServiceMap(String platformType) {
        return dataServiceMap.get(platformType);
    }
}
